#ifndef DEPARTCLINICIANVIEW_H
#define DEPARTCLINICIANVIEW_H

#include <QWidget>
#include <QTableView>
#include <QSqlTableModel>
#include "CustomWgt/LineEditDelegate.h"
#include "Settings/Model/MySqlTableModel.h"
#include "CustomWgt/TableWgt.h"


namespace Ui {

   class DepartClinician;
}

class DepartClinicianView : public QWidget
{
    Q_OBJECT
public:
    explicit DepartClinicianView(QWidget *parent = 0);
    ~DepartClinicianView();

    void showEvent(QShowEvent *e);
    void hideEvent(QHideEvent *e);
    void mousePressEvent(QMouseEvent *e);

    enum Grade {
         Grade_user,
         Grade_admin,
         Grade_service,
         Grade_production,
         Grade_developer
         };

 private:
    void getgrade();


private slots:
    void on_Btn_del_clicked();
    void on_Btn_add_clicked();
    void currentChangeHandle(int);

 protected slots:

    void myClearFocus();
    void dept_ScrollClicked(int value);
    void clinician_ScrollClicked(int value);
    void dept_Rangechange(int min_,int max_);
    void clinician_Rangechange(int min_,int max_);



private:
    Ui::DepartClinician *ui;
    void saveSettings();
    Grade grade_now;
    TableWgt* departTbv;
    TableWgt* clinicianTbv;
    MySqlTableModel *model_Depart;
    MySqlTableModel *model_Clinician;
    LineEditDelegate  *pDelegate;


    QStringList logtemp;
    QByteArray ba;
    void create_table();
    bool modules_change_save_depart();
    bool modules_change_save_clinician();
    void close_softKeyboard_handle();
    void delbuttonisEnabled(int index);


    QStringList departTempData;
    QStringList departTempData_now;
    QStringList departTempData_last;
    int  departments_compare_param_to_bak();
    int  depart_judge_name_if_repeat();


    QStringList clinicianTempData;
    QStringList clinicianTempData_now;
    QStringList clinicianTempData_last;
    int  clinician_compare_param_to_bak();
    int  clinician_judge_name_if_repeat();


    void depart_add();
    void depart_del();

    void clinician_add();
    void clinician_del();

};

#endif // DEPARTCLINICIANVIEW_H
